using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace InputProductForm
{

    class TProductType
    {
        UTLDB.UTLDB _cn = new UTLDB.UTLDB();
        public DataTable GetProType()
        {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelecttblProductTypesAll");
            return data;
        }
        public DataTable GetProTypeByActive(int active)
        {
            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelecttblProductTypesByActive", 
                new string[] {"@Active" },
               new object[] { active });
            return data;
        }
        public int Insert(Info.InfoProType info)
        {

            int id = _cn.ExecuteInsert("sp_InserttblProductType",
               new string[] { "@Name", "@Active" },
               new object[] { info.Name, info.Active });
            return id;
        }
        public void Update(Info.InfoProType info)
        {
            int id = _cn.ExecuteNonQuery("sp_UpdatetblProductType",
                  new string[] { "@ID", "@Name", "@Active" },
                  new object[] { info.ID, info.Name, info.Active });

        }

    }
}
